<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>订单列表</title>
	<%@include file="../common/header.jsp" %>
	    <jsp:include page="../../common/webupload.jsp"></jsp:include>
</head>
<body>
<%@include file="../common/top.jsp" %>
<div class="section clearfix" style="margin-top: 10px;">
    <!--页面左边-->
      <%@include file="left.jsp" %>
    <!--/页面左边-->

    <!--页面左边-->
     <input type="hidden" name="id" value="${m.id }">
    <div class="right-auto">
        <div class="bg-wrap" style="min-height:765px;">

            <div class="sub-tit " style="margin: 0px;">
                <a class="add" href="javascript:history.go(-1);"><i class="iconfont icon-reply"></i>返回</a>
                <ul>
                    <li class="selected">
                        <a href="javascript:;">账号资料</a>
                    </li>
                </ul>
            </div>


            <div class="form-box">
                <dl class="form-group">
                    <dt>用户名：</dt>
                    <dd>
                        ${m.username }
                    </dd>
                </dl>
                <dl class="form-group">
                    <dt>头像：</dt>
                    <dd>
                        <input name="userImg" id="userImg" type="hidden" value="${m.userImg}" >
                        <span id="userImgDiv" style="display: inline-block;">选择图像</span>
                        <span id="tupian"  style="display: inline-block;"></span>
                        <img alt="" src="${pathUrl}/${m.userImg}" style="width: 30px;height: 30px;">
                </dl>

                <dl class="form-group">
                    <dt>邮箱：</dt>
                    <dd>
                        <input name="email" id="email" type="text" class="input" value="${m.email }" >
                </dl>
                <dl class="form-group">
                    <dt>手机：</dt>
                    <dd>
                        <input name="phone" id="phone"  type="text" class="input" value="${m.phone }">
                </dl>
                
            
              
                <dl class="form-group">
                    <dd>
                        <input id="btnSubmit" name="btnSubmit" type="button" onclick="submitUser()" value="确认修改" class="submit">
                    </dd>
                </dl>
            </div>


        </div>
    </div>
    <!--/页面左边-->
</div>
<script type="text/javascript">

  $(function(){
	    createWebUploader("#userImgDiv",function(result){
	    	$("#userImg").val(result.data.url);
	    	$("#tupian").empty();
	    	$("#tupian").html("<a href='${pathUrl}"+result.data.url+"' target='_black'><img src='${pathUrl}"+result.data.url+"' style='width: 40px;height:40px;'/></a>");
	    });
  });
  
  function submitUser(){
	  var userImg=$("#userImg").val();
	  var email=$("#email").val();
	  var phone=$("#phone").val();
	  if(userImg==""){
		  alert("请上传图片");
		  return false;
		  
	  }
	  
	  if(email==""){
		  alert("请输入邮箱！");
		  return false;
	  }
	  
	  if(phone==""){
		  alert("请输入手机号码！");
		  return false;
	  }
	  
	 var url="${pathUrl}/home/center/submitProinfo";
	 $.post(url,{email:email,phone:phone,userImg:userImg},function(resultObj){
		 if(resultObj.status==1){
			 alert(resultObj.msg);
			 return false;
		 }else{
			 alert(resultObj.msg);
		 }
	 })
  }
</script>
</body>
</html>